/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.edu.just.firstjavaapp.l15;

import cn.edu.just.firstjavaapp.l7.Person;

import java.io.*;

import static java.lang.System.out;

/**
 *
 * @author Administrator
 */
public class DataStreamReadTest01 {
    static final String dataFile = "c:/java/test01";
    public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
        int a ;
        double price ;
        String desc;
        
        ObjectInputStream in = null;
        
        try {
            in = new ObjectInputStream(new
            BufferedInputStream(new FileInputStream(dataFile)));  //wrapper
            price = in.readDouble();
            System.out.println(price);
            a = in.readInt();
            System.out.println(a);
            desc = in.readUTF();
            System.out.println(desc);
            Person s = (Person)in.readObject();
            s.print();
        } finally {
            out.close();
        }
        
    }
}
